package com.yami.shop.api.controller;

import com.yami.shop.bean.meituan.OrderStatusInfo;
import com.yami.shop.bean.meituan.ShopScope;
import com.yami.shop.service.ShopScopeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/MeituanShopScopeInfo")
public class ShopScopeCallbackController {

    @Autowired
    private ShopScopeService shopScopeService;

    //获取订单状态改变回调
    @PostMapping("/getShopScope")
    public ResponseEntity<Map> getOrderStatus(ShopScope shopScope){
        Map map = new HashMap();
        map.put("code","0");
        if(shopScope!=null){
            shopScope.setCreateTime(new Date());
            shopScopeService.saveOrUpdate(shopScope);
        }
        return ResponseEntity.ok(map);
    }
}
